// @Author EthanScriptOn
// @Desc
package controller

import (
	"gitee.com/fatzeng/srf_switch_basic_components/switch_log"
	"gitee.com/fatzeng/srf_switch_dynamic_logic_director/middleware"
	"gitee.com/fatzeng/srf_switch_dynamic_logic_director/response"
	"gitee.com/fatzeng/srf_switch_dynamic_logic_director/service"
	"github.com/gin-gonic/gin"
)

type BasicInformationController struct{}

func (b *BasicInformationController) Router(router *gin.Engine) {
	entry := router.Group("/switch_control/v1/basicInfo", middleware.IdentityVerification())
	entry.POST("/systemInfo", b.systemInfo)
}

func (b *BasicInformationController) systemInfo(ctx *gin.Context) {
	info, err := service.SystemInfo()
	if err != nil {
		switch_log.Logger().Error("BasicInformationController/systemInfo", err)
		ctx.JSON(200, response.GenerateCurrencyResponse(nil, response.Fail))
		return
	}
	ctx.JSON(200, response.GenerateCurrencyResponse(info, response.Success))
}
